# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=llhttp
pkgver=6.0.7
pkgrel=0
pkgdesc="Port of http_parser to llparse"
url="https://llhttp.org/"
license="MIT"
arch="all !riscv64" # limited by nodejs/npm
makedepends="cmake clang npm"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/nodejs/llhttp/archive/v$pkgver/llhttp-$pkgver.tar.gz"

prepare() {
	default_prepare
	npm ci
}

build() {
	make release
	cmake -S release -B releasebuild \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=ON
	cmake --build releasebuild
}

check() {
	npm test
}

package() {
	DESTDIR="$pkgdir" cmake --install releasebuild
	install -Dm644 LICENSE-MIT "$pkgdir"/usr/share/doc/$pkgname/LICENSE
}

sha512sums="
ac6f3f0f68d61f3513bd3bc960c13641f02cc28f5a35fce5db4040a63a07835bcc82fb705680dc94e516662ff68699dd7aac6be4ed9bf321d91ba8b8cf720d5b  llhttp-6.0.7.tar.gz
"
